
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>02-Yarn入门 · 千锋大前端小册-GP19-Node.js</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="古艺散人">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    

        
    
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="03-Express.html" />
    
    
    <link rel="prev" href="01-Node.js基础.html" />
    

    
        <link rel="shortcut icon" href='../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="bookmark" href='../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="apple-touch-icon" href='../source/images/apple-touch-icon.jpg'>
    
    
        
        <link rel="apple-touch-icon" sizes="120x120" href="../source/images/apple-touch-icon.jpg">
        
        <link rel="apple-touch-icon" sizes="180x180" href="../source/images/apple-touch-icon.jpg">
        
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"buttons":[{"user":"lurongtao","repo":"felixbooks-kbone","type":"star","size":"small","count":true}]};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="01-Node.js基础.html">
            
                <a href="01-Node.js基础.html">
            
                    
                    基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="01-Node.js基础.html">
            
                <a href="01-Node.js基础.html">
            
                    
                    01-Node.js基础
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.2" data-path="02-yarn.html">
            
                <a href="02-yarn.html">
            
                    
                    02-Yarn入门
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="03-Express.html">
            
                <a href="03-Express.html">
            
                    
                    03-Express
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="04-Koa2.html">
            
                <a href="04-Koa2.html">
            
                    
                    04-Koa2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="05-MongoDB.html">
            
                <a href="05-MongoDB.html">
            
                    
                    05-MongoDB
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="06-socket.html">
            
                <a href="06-socket.html">
            
                    
                    06-socket编程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../advanced/01-Node中间件.html">
            
                <a href="../advanced/01-Node中间件.html">
            
                    
                    高级
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../advanced/01-Node中间件.html">
            
                <a href="../advanced/01-Node中间件.html">
            
                    
                    01-Node中间件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../advanced/02-Node事件循环.html">
            
                <a href="../advanced/02-Node事件循环.html">
            
                    
                    02-Node事件循环
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../advanced/03-Node中间层.html">
            
                <a href="../advanced/03-Node中间层.html">
            
                    
                    03-Node中间层
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../thanks/">
            
                <a href="../thanks/">
            
                    
                    感谢
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >02-Yarn入门</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#yarn-&#x4F7F;&#x7528;&#x5165;&#x95E8;"><b></b>Yarn &#x4F7F;&#x7528;&#x5165;&#x95E8;</a></li><ul><ul><li><span class="title-icon "></span><a href="#1&#x3001;&#x5B89;&#x88C5;"><b></b>1&#x3001;&#x5B89;&#x88C5;</a></li><li><span class="title-icon "></span><a href="#2&#x3001;yarn-&#x4F7F;&#x7528;&#x65B9;&#x6CD5;"><b></b>2&#x3001;Yarn &#x4F7F;&#x7528;&#x65B9;&#x6CD5;</a></li></ul></ul></ul></div><a href="#yarn-&#x4F7F;&#x7528;&#x5165;&#x95E8;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="yarn-&#x4F7F;&#x7528;&#x5165;&#x95E8;"><a name="yarn-&#x4F7F;&#x7528;&#x5165;&#x95E8;" class="anchor-navigation-ex-anchor" href="#yarn-&#x4F7F;&#x7528;&#x5165;&#x95E8;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="yarn-&#x4F7F;&#x7528;&#x5165;&#x95E8;" class="plugin-anchor" href="#yarn-&#x4F7F;&#x7528;&#x5165;&#x95E8;"><i class="fa fa-link" aria-hidden="true"></i></a>Yarn &#x4F7F;&#x7528;&#x5165;&#x95E8;</h1>
<p>Yarn &#x5BF9;&#x4F60;&#x7684;&#x4EE3;&#x7801;&#x6765;&#x8BF4;&#x662F;&#x4E00;&#x4E2A;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x3002;&#x5B83;&#x53EF;&#x4EE5;&#x8BA9;&#x4F60;&#x4F7F;&#x7528;&#x5E76;&#x5206;&#x4EAB;&#x5168;&#x4E16;&#x754C;&#x5F00;&#x53D1;&#x8005;&#x7684;&#xFF08;&#x4F8B;&#x5982; JavaScript&#xFF09;&#x4EE3;&#x7801;&#x3002; Yarn &#x80FD;&#x591F;&#x5FEB;&#x901F;&#x3001;&#x5B89;&#x5168;&#x3001;&#x5E76;&#x53EF;&#x9760;&#x5730;&#x5B8C;&#x6210;&#x8FD9;&#x4E9B;&#x5DE5;&#x4F5C;&#xFF0C;&#x6240;&#x4EE5;&#x4F60;&#x4E0D;&#x7528;&#x6709;&#x4EFB;&#x4F55;&#x62C5;&#x5FC3;&#x3002;</p>
<p>&#x901A;&#x8FC7;Yarn&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5176;&#x4ED6;&#x5F00;&#x53D1;&#x8005;&#x9488;&#x5BF9;&#x4E0D;&#x540C;&#x95EE;&#x9898;&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;&#x4F7F;&#x81EA;&#x5DF1;&#x7684;&#x5F00;&#x53D1;&#x8FC7;&#x7A0B;&#x66F4;&#x7B80;&#x5355;&#x3002; </p>
<p>&#x4EE3;&#x7801;&#x901A;&#x8FC7;&#x5305;&#xFF08;package&#xFF09; (&#x6216;&#x8005;&#x79F0;&#x4E3A; &#x6A21;&#x5757;&#xFF08;module&#xFF09;) &#x7684;&#x65B9;&#x5F0F;&#x6765;&#x5171;&#x4EAB;&#x3002; &#x4E00;&#x4E2A;&#x5305;&#x91CC;&#x5305;&#x542B;&#x6240;&#x6709;&#x9700;&#x8981;&#x5171;&#x4EAB;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x4EE5;&#x53CA;&#x63CF;&#x8FF0;&#x5305;&#x4FE1;&#x606F;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x79F0;&#x4E3A; package.json&#x3002;</p>
<h3 id="1&#x3001;&#x5B89;&#x88C5;"><a name="1&#x3001;&#x5B89;&#x88C5;" class="anchor-navigation-ex-anchor" href="#1&#x3001;&#x5B89;&#x88C5;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="1&#x3001;&#x5B89;&#x88C5;" class="plugin-anchor" href="#1&#x3001;&#x5B89;&#x88C5;"><i class="fa fa-link" aria-hidden="true"></i></a>1&#x3001;&#x5B89;&#x88C5;</h3>
<p>yarn &#x5B89;&#x88C5;&#x8BF7;&#x8FDB; <a href="https://yarn.bootcss.com/docs/install/#mac-stable" target="_blank">&#x4F20;&#x9001;&#x95E8;</a></p>
<h3 id="2&#x3001;yarn-&#x4F7F;&#x7528;&#x65B9;&#x6CD5;"><a name="2&#x3001;yarn-&#x4F7F;&#x7528;&#x65B9;&#x6CD5;" class="anchor-navigation-ex-anchor" href="#2&#x3001;yarn-&#x4F7F;&#x7528;&#x65B9;&#x6CD5;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="2&#x3001;yarn-&#x4F7F;&#x7528;&#x65B9;&#x6CD5;" class="plugin-anchor" href="#2&#x3001;yarn-&#x4F7F;&#x7528;&#x65B9;&#x6CD5;"><i class="fa fa-link" aria-hidden="true"></i></a>2&#x3001;Yarn &#x4F7F;&#x7528;&#x65B9;&#x6CD5;</h3>
<p>&#x73B0;&#x5728; Yarn &#x5DF2;&#x7ECF; &#x5B89;&#x88C5;&#x5B8C;&#x6BD5;&#xFF0C;&#x53EF;&#x4EE5;&#x5F00;&#x59CB;&#x4F7F;&#x7528;&#x4E86;&#x3002; &#x4EE5;&#x4E0B;&#x662F;&#x4E00;&#x4E9B;&#x4F60;&#x9700;&#x8981;&#x7684;&#x6700;&#x5E38;&#x7528;&#x7684;&#x547D;&#x4EE4;&#xFF1A;</p>
<h4 id="21-&#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;&#x65B0;&#x9879;&#x76EE;"><a name="21-&#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;&#x65B0;&#x9879;&#x76EE;" class="anchor-navigation-ex-anchor" href="#21-&#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;&#x65B0;&#x9879;&#x76EE;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="21-&#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;&#x65B0;&#x9879;&#x76EE;" class="plugin-anchor" href="#21-&#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;&#x65B0;&#x9879;&#x76EE;"><i class="fa fa-link" aria-hidden="true"></i></a>2.1 &#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;&#x65B0;&#x9879;&#x76EE;</h4>
<pre><code>yarn init
</code></pre><h4 id="22-&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;&#x5305;"><a name="22-&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;&#x5305;" class="anchor-navigation-ex-anchor" href="#22-&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;&#x5305;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="22-&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;&#x5305;" class="plugin-anchor" href="#22-&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;&#x5305;"><i class="fa fa-link" aria-hidden="true"></i></a>2.2 &#x6DFB;&#x52A0;&#x4F9D;&#x8D56;&#x5305;</h4>
<pre><code>yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]
</code></pre><h4 id="23-&#x5C06;&#x4F9D;&#x8D56;&#x9879;&#x6DFB;&#x52A0;&#x5230;&#x4E0D;&#x540C;&#x4F9D;&#x8D56;&#x9879;&#x7C7B;&#x522B;&#x4E2D;"><a name="23-&#x5C06;&#x4F9D;&#x8D56;&#x9879;&#x6DFB;&#x52A0;&#x5230;&#x4E0D;&#x540C;&#x4F9D;&#x8D56;&#x9879;&#x7C7B;&#x522B;&#x4E2D;" class="anchor-navigation-ex-anchor" href="#23-&#x5C06;&#x4F9D;&#x8D56;&#x9879;&#x6DFB;&#x52A0;&#x5230;&#x4E0D;&#x540C;&#x4F9D;&#x8D56;&#x9879;&#x7C7B;&#x522B;&#x4E2D;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="23-&#x5C06;&#x4F9D;&#x8D56;&#x9879;&#x6DFB;&#x52A0;&#x5230;&#x4E0D;&#x540C;&#x4F9D;&#x8D56;&#x9879;&#x7C7B;&#x522B;&#x4E2D;" class="plugin-anchor" href="#23-&#x5C06;&#x4F9D;&#x8D56;&#x9879;&#x6DFB;&#x52A0;&#x5230;&#x4E0D;&#x540C;&#x4F9D;&#x8D56;&#x9879;&#x7C7B;&#x522B;&#x4E2D;"><i class="fa fa-link" aria-hidden="true"></i></a>2.3 &#x5C06;&#x4F9D;&#x8D56;&#x9879;&#x6DFB;&#x52A0;&#x5230;&#x4E0D;&#x540C;&#x4F9D;&#x8D56;&#x9879;&#x7C7B;&#x522B;&#x4E2D;</h4>
<p>&#x5206;&#x522B;&#x6DFB;&#x52A0;&#x5230; devDependencies&#x3001;peerDependencies &#x548C; optionalDependencies &#x7C7B;&#x522B;&#x4E2D;&#xFF1A;</p>
<pre><code>yarn add [package] --dev
yarn add [package] --peer
yarn add [package] --optional
</code></pre><p><strong>devDependencies&#x3001;peerDependencies &#x548C; optionalDependencies&#x533A;&#x522B;</strong></p>
<p>&#x5728;&#x4E00;&#x4E2A;Node.js&#x9879;&#x76EE;&#x4E2D;&#xFF0C;package.json&#x51E0;&#x4E4E;&#x662F;&#x4E00;&#x4E2A;&#x5FC5;&#x987B;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x5B83;&#x7684;&#x4E3B;&#x8981;&#x4F5C;&#x7528;&#x5C31;&#x662F;&#x7BA1;&#x7406;&#x9879;&#x76EE;&#x4E2D;&#x6240;&#x4F7F;&#x7528;&#x5230;&#x7684;&#x5916;&#x90E8;&#x4F9D;&#x8D56;&#x5305;&#xFF0C;&#x540C;&#x65F6;&#x5B83;&#x4E5F;&#x662F;npm&#x547D;&#x4EE4;&#x7684;&#x5165;&#x53E3;&#x6587;&#x4EF6;&#x3002;</p>
<p>npm &#x76EE;&#x524D;&#x652F;&#x6301;&#x4EE5;&#x4E0B;&#x51E0;&#x7C7B;&#x4F9D;&#x8D56;&#x5305;&#x7BA1;&#x7406;&#xFF1A;</p>
<ul>
<li>dependencies</li>
<li>devDependencies</li>
<li>peerDependencies</li>
<li>optionalDependencies</li>
<li>bundledDependencies / bundleDependencies</li>
</ul>
<p><strong>dependencies</strong></p>
<p>&#x5E94;&#x7528;&#x4F9D;&#x8D56;&#xFF0C;&#x6216;&#x8005;&#x53EB;&#x505A;&#x4E1A;&#x52A1;&#x4F9D;&#x8D56;&#xFF0C;&#x8FD9;&#x662F;&#x6211;&#x4EEC;&#x6700;&#x5E38;&#x7528;&#x7684;&#x4F9D;&#x8D56;&#x5305;&#x7BA1;&#x7406;&#x5BF9;&#x8C61;&#xFF01;&#x5B83;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x5E94;&#x7528;&#x4F9D;&#x8D56;&#x7684;&#x5916;&#x90E8;&#x5305;&#xFF0C;&#x8FD9;&#x4E9B;&#x4F9D;&#x8D56;&#x662F;&#x5E94;&#x7528;&#x53D1;&#x5E03;&#x540E;&#x6B63;&#x5E38;&#x6267;&#x884C;&#x65F6;&#x6240;&#x9700;&#x8981;&#x7684;&#xFF0C;&#x4F46;&#x4E0D;&#x5305;&#x542B;&#x6D4B;&#x8BD5;&#x65F6;&#x6216;&#x8005;&#x672C;&#x5730;&#x6253;&#x5305;&#x65F6;&#x6240;&#x4F7F;&#x7528;&#x7684;&#x5305;&#x3002;</p>
<p><strong>devDependencies</strong></p>
<p>&#x5F00;&#x53D1;&#x73AF;&#x5883;&#x4F9D;&#x8D56;&#xFF0C;&#x4EC5;&#x6B21;&#x4E8E;dependencies&#x7684;&#x4F7F;&#x7528;&#x9891;&#x7387;&#xFF01;&#x5B83;&#x7684;&#x5BF9;&#x8C61;&#x5B9A;&#x4E49;&#x548C;dependencies&#x4E00;&#x6837;&#xFF0C;&#x53EA;&#x4E0D;&#x8FC7;&#x5B83;&#x91CC;&#x9762;&#x7684;&#x5305;&#x53EA;&#x7528;&#x4E8E;&#x5F00;&#x53D1;&#x73AF;&#x5883;&#xFF0C;&#x4E0D;&#x7528;&#x4E8E;&#x751F;&#x4EA7;&#x73AF;&#x5883;&#xFF0C;&#x8FD9;&#x4E9B;&#x5305;&#x901A;&#x5E38;&#x662F;&#x5355;&#x5143;&#x6D4B;&#x8BD5;&#x6216;&#x8005;&#x6253;&#x5305;&#x5DE5;&#x5177;&#x7B49;&#xFF0C;&#x4F8B;&#x5982;gulp, grunt, webpack, moca, coffee&#x7B49;&#x3002;</p>
<p><strong>peerDependencies</strong></p>
<p>&#x540C;&#x7B49;&#x4F9D;&#x8D56;&#xFF0C;&#x6216;&#x8005;&#x53EB;&#x540C;&#x4F34;&#x4F9D;&#x8D56;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x5F53;&#x524D;&#x5305;&#xFF08;&#x4E5F;&#x5C31;&#x662F;&#x4F60;&#x5199;&#x7684;&#x5305;&#xFF09;&#x517C;&#x5BB9;&#x7684;&#x5BBF;&#x4E3B;&#x7248;&#x672C;&#x3002;&#x5982;&#x4F55;&#x7406;&#x89E3;&#x5462;&#xFF1F; &#x8BD5;&#x60F3;&#x4E00;&#x4E0B;&#xFF0C;&#x6211;&#x4EEC;&#x7F16;&#x5199;&#x4E00;&#x4E2A;gulp&#x7684;&#x63D2;&#x4EF6;&#xFF0C;&#x800C;gulp&#x5374;&#x6709;&#x591A;&#x4E2A;&#x4E3B;&#x7248;&#x672C;&#xFF0C;&#x6211;&#x4EEC;&#x53EA;&#x60F3;&#x517C;&#x5BB9;&#x6700;&#x65B0;&#x7684;&#x7248;&#x672C;&#xFF0C;&#x6B64;&#x65F6;&#x5C31;&#x53EF;&#x4EE5;&#x7528;&#x540C;&#x7B49;&#x4F9D;&#x8D56;&#xFF08;peerDependencies&#xFF09;&#x6765;&#x6307;&#x5B9A;&#x3002;</p>
<pre><code class="lang-json">{
  <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;gulp-my-plugin&quot;</span>,
  <span class="hljs-string">&quot;version&quot;</span>: <span class="hljs-string">&quot;0.0.1&quot;</span>,
  <span class="hljs-string">&quot;peerDependencies&quot;</span>: {
    <span class="hljs-string">&quot;gulp&quot;</span>: <span class="hljs-string">&quot;3.x&quot;</span>
  }
}
</code></pre>
<p><strong>optionalDependencies</strong></p>
<p>&#x53EF;&#x9009;&#x4F9D;&#x8D56;&#xFF0C;&#x5982;&#x679C;&#x6709;&#x4E00;&#x4E9B;&#x4F9D;&#x8D56;&#x5305;&#x5373;&#x4F7F;&#x5B89;&#x88C5;&#x5931;&#x8D25;&#xFF0C;&#x9879;&#x76EE;&#x4ECD;&#x7136;&#x80FD;&#x591F;&#x8FD0;&#x884C;&#x6216;&#x8005;&#x5E0C;&#x671B;npm&#x7EE7;&#x7EED;&#x8FD0;&#x884C;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;optionalDependencies&#x3002;&#x53E6;&#x5916;optionalDependencies&#x4F1A;&#x8986;&#x76D6;dependencies&#x4E2D;&#x7684;&#x540C;&#x540D;&#x4F9D;&#x8D56;&#x5305;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x8981;&#x5728;&#x4E24;&#x4E2A;&#x5730;&#x65B9;&#x90FD;&#x5199;&#x3002;</p>
<p><strong>bundledDependencies / bundleDependencies</strong></p>
<p>&#x6253;&#x5305;&#x4F9D;&#x8D56;&#xFF0C;bundledDependencies&#x662F;&#x4E00;&#x4E2A;&#x5305;&#x542B;&#x4F9D;&#x8D56;&#x5305;&#x540D;&#x7684;&#x6570;&#x7EC4;&#x5BF9;&#x8C61;&#xFF0C;&#x5728;&#x53D1;&#x5E03;&#x65F6;&#x4F1A;&#x5C06;&#x8FD9;&#x4E2A;&#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x5305;&#x6253;&#x5305;&#x5230;&#x6700;&#x7EC8;&#x7684;&#x53D1;&#x5E03;&#x5305;&#x91CC;&#x3002;</p>
<h4 id="24-&#x5347;&#x7EA7;&#x4F9D;&#x8D56;&#x5305;"><a name="24-&#x5347;&#x7EA7;&#x4F9D;&#x8D56;&#x5305;" class="anchor-navigation-ex-anchor" href="#24-&#x5347;&#x7EA7;&#x4F9D;&#x8D56;&#x5305;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="24-&#x5347;&#x7EA7;&#x4F9D;&#x8D56;&#x5305;" class="plugin-anchor" href="#24-&#x5347;&#x7EA7;&#x4F9D;&#x8D56;&#x5305;"><i class="fa fa-link" aria-hidden="true"></i></a>2.4 &#x5347;&#x7EA7;&#x4F9D;&#x8D56;&#x5305;</h4>
<pre><code>yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]
</code></pre><h4 id="25-&#x79FB;&#x9664;&#x4F9D;&#x8D56;&#x5305;"><a name="25-&#x79FB;&#x9664;&#x4F9D;&#x8D56;&#x5305;" class="anchor-navigation-ex-anchor" href="#25-&#x79FB;&#x9664;&#x4F9D;&#x8D56;&#x5305;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="25-&#x79FB;&#x9664;&#x4F9D;&#x8D56;&#x5305;" class="plugin-anchor" href="#25-&#x79FB;&#x9664;&#x4F9D;&#x8D56;&#x5305;"><i class="fa fa-link" aria-hidden="true"></i></a>2.5 &#x79FB;&#x9664;&#x4F9D;&#x8D56;&#x5305;</h4>
<pre><code>yarn remove [package]
</code></pre><h4 id="26-&#x5B89;&#x88C5;&#x9879;&#x76EE;&#x7684;&#x5168;&#x90E8;&#x4F9D;&#x8D56;"><a name="26-&#x5B89;&#x88C5;&#x9879;&#x76EE;&#x7684;&#x5168;&#x90E8;&#x4F9D;&#x8D56;" class="anchor-navigation-ex-anchor" href="#26-&#x5B89;&#x88C5;&#x9879;&#x76EE;&#x7684;&#x5168;&#x90E8;&#x4F9D;&#x8D56;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="26-&#x5B89;&#x88C5;&#x9879;&#x76EE;&#x7684;&#x5168;&#x90E8;&#x4F9D;&#x8D56;" class="plugin-anchor" href="#26-&#x5B89;&#x88C5;&#x9879;&#x76EE;&#x7684;&#x5168;&#x90E8;&#x4F9D;&#x8D56;"><i class="fa fa-link" aria-hidden="true"></i></a>2.6 &#x5B89;&#x88C5;&#x9879;&#x76EE;&#x7684;&#x5168;&#x90E8;&#x4F9D;&#x8D56;</h4>
<pre><code>yarn
</code></pre><p>&#x6216;&#x8005;</p>
<pre><code>yarn install
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="01-Node.js基础.html" class="navigation navigation-prev " aria-label="Previous page: 01-Node.js基础">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="03-Express.html" class="navigation navigation-next " aria-label="Next page: 03-Express">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"02-Yarn入门","level":"1.2.2","depth":2,"next":{"title":"03-Express","level":"1.2.3","depth":2,"path":"basics/03-Express.md","ref":"./basics/03-Express.md","articles":[]},"previous":{"title":"01-Node.js基础","level":"1.2.1","depth":2,"path":"basics/01-Node.js基础.md","ref":"./basics/01-Node.js基础.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","splitter","expandable-chapters-small","anchors","github","github-buttons","sharing-plus","anchor-navigation-ex","favicon","insert-logo","livereload"],"styles":{"website":"./styles/website.css"},"pluginsConfig":{"github":{"url":"https://gitee.com/lurongtao/felixbooks-gp19-Node.js"},"livereload":{},"splitter":{},"search":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"favicon":{"shortcut":"./source/images/favicon.jpg","bookmark":"./source/images/favicon.jpg","appleTouch":"./source/images/apple-touch-icon.jpg","appleTouchMore":{"120x120":"./source/images/apple-touch-icon.jpg","180x180":"./source/images/apple-touch-icon.jpg"}},"github-buttons":{"buttons":[{"user":"lurongtao","repo":"felixbooks-kbone","type":"star","size":"small","count":true}]},"expandable-chapters-small":{},"sharing":{"qq":false,"all":["google","facebook","weibo","twitter","qq","qzone","linkedin","pocket"],"douban":false,"facebook":false,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"insert-logo":{"url":"/felixbooks-gp19-node.js/images/node.js.jpg","style":"background: skyblue; width: 100%; height: 100%;"}},"theme":"default","author":"古艺散人","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"千锋大前端小册-GP19-Node.js","language":"zh-hans","links":{},"gitbook":"3.2.3","description":"Node.js复习"},"file":{"path":"basics/02-yarn.md","mtime":"2020-06-21T10:34:11.055Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-15T09:28:56.165Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

